<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <%@include file ="../include/link.jsp"%>       
        <script language="javascript" type="text/javascript">
            //排序按钮的点击事件
            function sort(btnObj) {
                if (btnObj.className == "sort_desc")
                    btnObj.className = "sort_asc";
                else
                    btnObj.className = "sort_desc";
            }

            //启用
            function startFee(no) {
                /* var r = window.confirm("确定要启用此资费吗？资费启用后将不能修改和删除。");
                document.getElementById("operate_result_info").style.display = "block"; */
            	 document.getElementById("hi").value=no;
   				document.getElementById("hi").name="start";
   				document.getElementById("myform").submit();
            }
            //修改
            function modifyFee(no){
            	 document.getElementById("hi").value=no;
  				document.getElementById("hi").name="modify";
  				document.getElementById("myform").submit();
            	
            }
            //删除
            function deleteFee(no) {
            	 document.getElementById("hi").value=no;
   				document.getElementById("hi").name="delete";
   				document.getElementById("myform").submit();
               /*  var r = window.confirm("确定要删除此资费吗？");
                document.getElementById("operate_result_info").style.display = "block"; */
            }
            $(function(){
            	$("tr:even").css("background-color","#DDD");
            	$("tr:odd").css("background-color","#CCC");
            	$("tbody tr").hover(function(){
           			$(this).css("background-color","red");          		
           			},function(){
           				$("tr:even").css("background-color","#DDD");
                    	$("tr:odd").css("background-color","#CCC");
           			});
            	});
        </script>        
    </head>
    <body>
        <!--Logo区域开始-->
        <div id="header">
            <img src="../images/logo.png" alt="logo" class="left"/>
			<span>当前账号：<b>scott</b></span>
            <a href="#">[退出]</a>            
        </div>
        <!--Logo区域结束-->
        <!--导航区域开始-->
        <div id="navi">                        
            <ul id="menu">
            <%@include file ="../include/main.jsp"%> 
            <%--     <li><a href="index.jsp" class="index_on"></a></li>
            <c:forEach items ="${admin.lp}" var="alp">
            	 <li><a href="${alp.per_url}" class="${alp.per_class}"></a></li>
            </c:forEach>
            <li><a href="${pageContext.request.contextPath}/view/user/user_info.jsp" class="information_off"></a></li>
            <li><a href="${pageContext.request.contextPath}/view/user/user_modi_pwd.jsp" class="password_off"></a></li> --%>
            </ul>            
        </div>
        <!--导航区域结束-->
        <!--主要区域开始-->
        <div id="main">
            <form id="myform" action="${pageContext.request.contextPath}/tariff/DeleteFeeServlet" method="post">
                <!--排序-->
                <div class="search_add">
                    <div>
                        <input type="button" value="月租" class="sort_asc" onclick="sort(this);" />
                        <input type="button" value="基费" class="sort_asc" onclick="sort(this);" />
                        <input type="button" value="时长" class="sort_asc" onclick="sort(this);" />
                    </div>
                    <input type="button" value="增加" class="btn_add" onclick="location.href='../view/fee/fee_add.jsp';" />
                </div> 
                <!--启用操作的操作提示-->
                <div id="operate_result_info" class="operate_success">
                    <img src="../images/close.png" onclick="this.parentNode.style.display='none';" />
                    删除成功！
                </div>    
                <!--数据区域：用表格展示数据-->     
                <div id="data">            
                    <table id="datalist">
                        <tr>
                            <th>资费ID</th>
                            <th class="width100">资费名称</th>
                            <th>基本时长</th>
                            <th>基本费用</th>
                            <th>单位费用</th>
                            <th>创建时间</th>
                            <th>开通时间</th>
                            <th class="width50">状态</th>
                            <th class="width200"></th>
                        </tr> 
                        <c:forEach items="${ta}" var="tar"> 
                        <tbody>                
	                        <tr>
	                            <td>${tar.tar_no}</td>
	                            <td><a href="${pageContext.request.contextPath}/tariff/DetailServlet?tar_no=${tar.tar_no}">${tar.tar_name}</a></td>
	                            <td><c:if test="${tar.tar_btime!=0}">${tar.tar_btime}小时</c:if>  </td>
	                            <td><c:if test="${tar.tar_bcost!=0}">${tar.tar_bcost}元</c:if> </td>
	                            <td><c:if test="${tar.tar_ucost!=0}">${tar.tar_ucost}元/小时</c:if></td>
	                            <td>${tar.tar_ctime}</td>
	                            <td>${tar.tar_ktime}</td>
	                            <td><c:if test="${tar.tar_state==1}">开通</c:if>
	                            	<c:if test="${tar.tar_state==0}">暂停</c:if>
	                            </td>
	                            <td> 
	                            <c:if test="${tar.tar_state==0}" >                             
	                                <input type="button" value="启用" class="btn_start" onclick="startFee(${tar.tar_no});" />
	                                <input type="button" value="修改" class="btn_modify" onclick="modifyFee(${tar.tar_no});" />
	                                <input type="button" value="删除" class="btn_delete" onclick="deleteFee(${tar.tar_no});" />
	                            </c:if>  
	                            </td>	                            
	                        </tr>
	                        </tbody>  
                        </c:forEach>
                         <input type="hidden" id="hi" name="" value=""/>  
                    </table>
                    <p>业务说明：<br />
                    1、创建资费时，状态为暂停，记载创建时间；<br />
                    2、暂停状态下，可修改，可删除；<br />
                    3、开通后，记载开通时间，且开通后不能修改、不能再停用、也不能删除；<br />
                    4、业务账号修改资费时，在下月底统一触发，修改其关联的资费ID（此触发动作由程序处理）
                    </p>
                </div>
                <!--分页-->
                <div id="pages">
        	        <a href="#">上一页</a>
                    <a href="#" class="current_page">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                    <a href="#">4</a>
                    <a href="#">5</a>
                    <a href="#">下一页</a>
                </div>
            </form>
        </div>
        <!--主要区域结束-->
        <div id="footer">
           
        </div>
    </body>
</html>